import {
    requestDetailInfo
} from "@/api"

// vuex的home模块配置
const state = {
    detailInfo: {}
}
const mutations = {
    SET_DETAILINFOT_STATE(state, value) {
        state.detailInfo = value
    }
}
const actions = {
    //异步发送三级列表数据请求
    async getdetailInfo({
        commit
    }, skuId) {
        const result = await requestDetailInfo(skuId)
        commit('SET_DETAILINFOT_STATE', result)
    }
}
const getters = {
    categoryView(state) {
        return state.detailInfo.categoryView || {}
    },
    skuInfo(state) {
        return state.detailInfo.skuInfo || {}
    },
    spuSaleAttrList(state) {
        return state.detailInfo.spuSaleAttrList || []
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters
}